home *** CD-ROM | disk | FTP | other *** search
-
- /*********************************************************************
- * FAX Library: [9.X.86] |
- *-----------------------
- *
- * fx.c-- or, fun with ST fonts (generic text screen dump).
- * (Megamax in-line assembly version.)
- *
- * ( Test version is typed in at keyboard under TOS: )
- * ( fx <top left x-coord of dump window> <top left y-coord> )
- * ( <width of dump window> <height of dump window> )
- * ( <keyboard abort enable: 'y' or 'Y' => enabled, else not> )
- *
- * Files (".ca" => in-line assembly code):
- * fxcomp.h: compiler switches.
- * fxd.h: constants and data declarations.
- * fxm.h: memory allocation constants.
- * fx.c: C code top level: initialization.
- * (includes "fxd.h", "f5.ca", <stdio.h>,
- * and <osbind.h>.)
- * f5.ca: top level of assembly language routines.
- * (includes "f6.ca", "f7.ca", "f8.ca", and
- * "fs1.ca".)
- * f6.ca: part 1 of special routines.
- * f7.ca: part 2 of special routines.
- * f8.ca: part 3 of special routines.
- * fs1.ca: miscellaneous routines.
- * --these are compiled and collected into "faxlib", which is then
- * linked to from "fax.o" to produce "fax.acc".
- *
- *
- *********************************************************************/
-
- #include <stdio.h> /* for 'malloc()' use */
- #include <osbind.h> /* for Gemdos calls */
- #include "fxcomp.h" /* compiler switches */
- #include "fxm.h" /* data structure sizes */
- #include "fxd.h" /* constants and data declarations */
-
-
- /* Memory for the following large data structures is allocated in */
- /* "fax.o": */
- #ifdef GEM_VER
- extern long *scan_packs; /* pointer to collision list */
- extern long *hash_table; /* pointer to hash table */
- extern int *chunk; /* pointer to saved window */
- extern char *dump_space; /* pointer to dumped ascii codes */
- #endif
-
- #ifdef TEST_VER
- #ifdef SC_IMAGE
- int *chunk;
- #endif
- long *scan_packs; /* collision list */
- long *hash_table; /* hash table */
- char *dump_space; /* dumped codes */
- #endif
-
-
- /****
- *
- * TOS test == 'main'-- some C code for initialization, &c.
- * Run version == 'fax_exec'-- called from desk accessory.
- *
- ****/
-
- #ifdef TEST_VER
- main(argc,argv)
- int argc;
- char *argv[]; /* command line == test switches */
- #endif
-
- #ifdef GEM_VER
- int fax_exec(fx_x,fx_y,fx_w,fx_h,fx_to,fx_herr,fx_rerr,f_i,k_a,trgr,T_v,
- h_5)
- int fx_x; /* top left x-coord of dump area */
- int fx_y; /* top left y-coord of dump area */
- int fx_w; /* pixel width of dump area */
- int fx_h; /* pixel height of dump area */
- int *fx_to; /* TRUE => printer timeout error */
- int *fx_herr; /* hash error count */
- int *fx_rerr; /* recognize error count */
- int f_i; /* nr of extra scan lines between text lines */
- int k_a; /* TRUE => keyboard abort enabled */
- int trgr; /* trigger code for TOS resident version */
- int T_v; /* TRUE => TOS version active */
- int h_5; /* TRUE => 6 x 6 font in use */
- #endif
- {
- int printed; /* return from 'psend()'-- TRUE => timeout error */
-
- #ifdef TEST_VER
- /* allocate memory for data structures */
- scan_packs = (long *)calloc(SCAN_P_SIZE,1);
- hash_table = (long *)calloc(HASH_T_SIZE,1);
- dump_space = calloc(DUMP_SIZE,1);
- #ifdef SC_IMAGE
- chunk = (int *)calloc(CHUNK_SIZE,1);
- #endif
- #endif
-
- /* initialize dump string storage area */
- for (i = 0, p_ptr = dump_space; i < DUMP_SIZE; i++)
- *p_ptr++ = '\0';
-
- #ifdef SC_IMAGE
- /* clear window storage area */
- for (i = 0, p_ptr = (char *)chunk; i < CHUNK_SIZE; i++)
- *p_ptr++ = ' ';
- #endif
-
- /* clumsy transfer of parms from caller */
- #ifdef GEM_VER
- form_inc = f_i;
- kbd_abort = k_a;
- trigger = trgr;
- TOS_ver = T_v;
- #endif
-
- /* set dump coordinates */
- #ifdef TEST_VER
- form_inc = 0;
- kbd_abort = 0;
-
- if (argc >= ARG_NR)
- {
- w_xc = atol(argv[1]);
- w_yc = atol(argv[2]);
- w_width = atol(argv[3]);
- w_height = atol(argv[4]);
- a_test = (tolower(*argv[5]) == 'y') ? 0 : -1;
- hi50 = (argc > ARG_NR) ? 0 : -1;
- printf("fx test version 1.0...\n");
- }
- else
- {
- printf("error\n");
- exit(1);
- }
- #endif
-
- #ifdef GEM_VER
- w_xc = (long)fx_x;
- w_yc = (long)fx_y;
- w_width = (long)fx_w;
- w_height = (long)fx_h;
- a_test = 1;
- hi50 = (long)h_5;
- #endif
-
- bit_off = 0; /* starting bit offset */
-
- /* call dump routine */
- dumper();
-
- if (func_ret != ABORT)
- {
- /* print dumped strings */
- p_ptr = dump_space;
- for (i = 0, stop_it = FALSE; (i < LINE_NR) && (!stop_it); i++)
- {
- #ifdef TEST_VER
- printf("%s\n", p_ptr);
- #endif
- #ifdef GEM_VER
- if (!(printed = psend(p_ptr)))
- break;
- #endif
- p_ptr += LINE_LEN;
- stop_it = (*p_ptr == '\0') ? TRUE : FALSE;
- }
- #ifdef TEST_VER
- if (!printed)
- printf("printer timeout error\n");
- if (hash_errors > 0)
- printf("hash errors = %d\n",(int)hash_errors);
- if (recg_errors > 0)
- printf("recognize errors = %d\n",(int)recg_errors);
- #endif
- }
-
- #ifdef GEM_VER
- *fx_to = !printed;
- *fx_herr = (int)hash_errors;
- *fx_rerr = (int)recg_errors;
- #endif
-
- /* program exit */
- #ifdef TEST_VER
- exit(0);
- #endif
- #ifdef GEM_VER
- return GOOD;
- #endif
-
- } /* end of 'main()' or 'fax_exec()' */
-
- #include "f9.c" /* miscellaneous c routines */
- #include "f5.ca" /* assembly language routines */
-
-
-
-
-